home *** CD-ROM | disk | FTP | other *** search
/ New Star Software Collection / NSS_Collection.iso / 3-170 dbase 10 for windows / 1.ima / SAMPLES.PAK / WINAPI.PRG < prev   
Text File  |  1993-07-26  |  5KB  |  134 lines

  1. *******************************************************************************
  2. *  PROGRAM:      WinApi.prg
  3. *
  4. *  WRITTEN BY:   Borland Late Night Crew
  5. *
  6. *  DATE:         6/28/93
  7. *
  8. *  UPDATED:      7/19/93
  9. *
  10. *  VERSION:      Alpha α
  11. *
  12. *  DESCRIPTION:  This program shows how to access useful Windows API functions
  13. *                using Bladerunner's API interface.
  14. *                A window is displayed with a pushbuttons containing different
  15. *                information that can be accessed with the Windows API through
  16. *                Bladerunner.  Pressing a pushbutton executes the selected
  17. *                function (or series of functions).  The CANCEL pushbutton
  18. *                closes the window.
  19. *
  20. *  PARAMETERS:   None
  21. *
  22. *  CALLS:
  23. *                GetVersion()
  24. *                GetWinFlags()
  25. *                GetModuleUsage()
  26. *                GetModuleHandle()
  27. *                GetVersion()
  28. *                ShowWindow()
  29. *                GetFreeSpace()
  30. *                SystemParametersInfo()
  31. *                MessageBox()
  32. *                GetWindowsDirectory()
  33. *                GetWindowText()
  34. *                CloseWindow()
  35. *                OpenIcon()
  36. *                GetWindowsDirectory()
  37. *
  38. *  USAGE:        DO Winapi
  39. *
  40. *
  41. *
  42. *******************************************************************************
  43. set talk off
  44. set procedure to sampproc
  45.  
  46. public show
  47. show = "System Information"
  48.  
  49. define window Api from 5,25 to 17,59 of application;
  50.    title "Bladerunner Windows API";
  51.    sizeable
  52. * pushbuttons referring to different functions/groups of functions to execute
  53. define pushbutton sysinfo of Api at 1,1 prompt   "System Information"
  54. define pushbutton okcanbox of Api at 3,1 prompt  "   Message Box    "
  55. define pushbutton winwall of Api at 5,1 prompt   "    Wallpaper     "
  56. define pushbutton getwintx of Api at 7,1 prompt  " Window Captions  "
  57. define pushbutton windir of Api at 9,1 prompt   "Windows Directory "
  58. define pushbutton cancel of Api prompt "CANCEL" at 5,25
  59. on selection window Api do OnSelApi
  60. open window Api
  61. set focus to Api
  62.  
  63. return
  64.  
  65. *************************** End of WinApi.prg *********************************
  66.  
  67.  
  68. *** Procedures and Functions called by OpenWind.prg ***
  69.  
  70.  
  71. *******************************************************************************
  72. procedure ShowInfo
  73.  
  74. * Brings up the Info window.  This window contains text objects that correspond
  75. * to whatever information was selected for viewing in the previous, SelectInfo
  76. * window, and an image containing the map of Europe highlighting the currently
  77. * selected country.  "Cancel" in this window closes it.
  78. *******************************************************************************
  79. private cnt,countryName,background,newArea
  80. windCnt = windCnt + 1
  81. cnt = ltrim(str(windCnt))
  82. countryName = rtrim(country->name)+cnt  && in case the same country is chosen
  83.                                         && more than once
  84. background = iif(mod(windCnt,2)=0,"b","bg")  && alternate background window color
  85. newArea = ltrim(str(select()))
  86. if newArea <> "0"
  87.    use country in select() again alias &countryName
  88.    select &countryName
  89.    * don't let the windows go off the screen
  90.    define window Info&cnt from 2+mod(windCnt*2,20),30 + mod(windCnt,10);
  91.       to 13+mod(windCnt*2,20),70+mod(windCnt,10) ;
  92.       of application;
  93.       title "Info -- " + country->name;
  94.       sizeable;
  95.       color w+/&background
  96.    * show the population field for the current country
  97.    define text popText of Info&cnt at 2,3 prompt "Population:"
  98.    define text popInfo of Info&cnt at 3,5 prompt country->population;
  99.       picture "999,999,999,999" function "T" color rb/&background
  100.    * show the capital field for the current country
  101.    define text capText of Info&cnt at 5,3 prompt "Capital:"
  102.    define text capInfo of Info&cnt at 6,5 prompt upper(country->capital);
  103.       color rb/&background
  104.    * show the map of the current country highlighted on a map of Europe
  105.    define text mapText of Info&cnt at 1,25 prompt country->name;
  106.       color gr+/&background
  107.    define image map of Info&cnt from 2,20 to 12,38 memo country->map
  108.    define pushbutton cancel of Info&cnt at 8,5 prompt "CANCEL" default
  109.    on selection window Info&cnt close window Info&cnt
  110.  
  111.    * OPEN this window, and set focus to it.  This command causes Info to be
  112.    * added to the list of the currently open windows, but doesn't stop program
  113.    * control flow at the OPEN line.  This window is not modal.
  114.    open window Info&cnt
  115.    set focus to Info&cnt
  116. else && no more available areas
  117.    * Cheap warning
  118.    ?"No more available workareas"
  119. endif
  120.  
  121. return
  122.  
  123.  
  124. *******************************************************************************
  125. function Open_Clean
  126.  
  127. * This function closes the Country database, and releases all public variables.
  128. *******************************************************************************
  129. close all
  130. select &savearea
  131. release savearea
  132. return .t.
  133.  
  134.